package com.kedi.journalismcenter.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kedi.journalismcenter.service.GoldenRadioService;

/**
 * 
 *
 * @ClassName StorytellingController
 * @author: 陈辽逊
 * @date: 2019/7/13 11:14
 */
@Controller
public class GoldenRadioController {

	@Autowired
	public GoldenRadioService service;

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/selectstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping("/getstorytelling")
	@ResponseBody
	public List<Map<String, Object>> getstorytelling(int total_page, int limit) {
		if (total_page != 0 && limit != 0) {
			int page = (total_page - 1) * limit;
			return service.storytelling(page, limit);
		} else {
			return null;
		}

	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/selectopera
	 * @return 返回一个数据对象
	 */
	@RequestMapping("/getopera")
	@ResponseBody
	public List<Map<String, Object>> getopera(int total_page, int limit) {
		if (total_page != 0 && limit != 0) {
			int page = (total_page - 1) * limit;
			return service.opera(page, limit);
		} else {
			return null;
		}
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/selectmusic
	 * @return 返回一个数据对象
	 */
	@RequestMapping("/getmusic")
	@ResponseBody
	public List<Map<String, Object>> selectmusic(int total_page, int limit) {
		if (total_page != 0 && limit != 0) {
			int page = (total_page - 1) * limit;
			return service.music(page, limit);
		} else {
			return null;
		}
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/selectreview
	 * @return 返回一个数据对象
	 */
	@RequestMapping("/getreview")
	@ResponseBody
	public List<Map<String, Object>> getreview(int total_page, int limit) {
		if (total_page != 0 && limit != 0) {
			int page = (total_page - 1) * limit;
			return service.review(page, limit);
		} else {
			return null;
		}
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/insertstorytelling", method = RequestMethod.POST)
	@ResponseBody
	public int insertstorytelling(@RequestParam Map map) {
		return service.istorytelling(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/updatestorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/updatestorytelling", method = RequestMethod.POST)
	@ResponseBody
	public int updatestorytelling(@RequestParam Map map) {
		return service.storytelling(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertopera
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/insertopera", method = RequestMethod.POST)
	@ResponseBody
	public int insertopera(@RequestParam Map map) {
		return service.iopera(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/updateopera
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/updateopera", method = RequestMethod.POST)
	@ResponseBody
	public int updateopera(@RequestParam Map map) {
		return service.opera(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/insertmusic", method = RequestMethod.POST)
	@ResponseBody
	public int insermusic(@RequestParam Map map) {
		return service.imusic(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/updatemusic", method = RequestMethod.POST)
	@ResponseBody
	public int updatemusic(@RequestParam Map map) {
		return service.imusic(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/insertreview", method = RequestMethod.POST)
	@ResponseBody
	public int insertreview(@RequestParam Map map) {
		return service.ireview(map);
	}

	/**
	 * @Description: 获取前台提交的参数，指定映射方法名为/insertstorytelling
	 * @return 返回一个数据对象
	 */
	@RequestMapping(value = "/updatereview", method = RequestMethod.POST)
	@ResponseBody
	public int updatereview(@RequestParam Map map) {
		return service.review(map);
	}
}
